package com.donn.securitycontrolplatform.dutyinfo.service.impl;


import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.donn.securitycontrolplatform.common.Result;
import com.donn.securitycontrolplatform.db2.mapper.DutyinfoMapper;
import com.donn.securitycontrolplatform.dutyinfo.entity.Dutyinfo;
import com.donn.securitycontrolplatform.dutyinfo.service.IDutyinfoService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author zhenglx
 * @since 2022-06-19
 */
@Service
@DS("db2")
public class DutyinfoServiceImpl extends ServiceImpl<DutyinfoMapper, Dutyinfo> implements IDutyinfoService {

    /**
     * @param dutyinfo
     * @return
     */
    @Override
    public Result add(Dutyinfo dutyinfo) {
        save(dutyinfo);
        return Result.success("");
    }

    @Override
    public Result updateDutyinfo(Dutyinfo dutyinfo) {
        updateById(dutyinfo);
        return Result.success("");
    }

    @Override
    public Result deleteById(Integer id) {
        removeById(id);
        return Result.success("");
    }

    @Override
    public Result getPage(Page<Dutyinfo> page) {

        return Result.success(page(page));
    }

    @Override
    public List<String> getTagByDutyinfo(String name) {
        return baseMapper.getTagByDutyinfo(name);
    }
}
